package cn.wolfcode.trip.base.domain;

import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Setter
@Getter
public class Order {

    public static final int  STATE_WAITING = 0; // 待发货
    public static final int  STATE_SENDING = 1; // 已发货
    public static final int  STATE_ARRIVE = 2; // 已签收
    public static final int  STATE_REFUNDING = 3; // 退款中
    public static final int  STATE_REFUNDED = 4; // 已退款
    public static final int INNEED_RECEIPT = 0; // 不要发票
    public static final int NEED_RECEIPT = 1; // 要发票
    public static final int POST_FREE = 1; // 包邮
    public static final int POST_SELF = 0; // 不包邮

    private Long id;  // 主键id

    private User user; // 下单用户

    private Item item; // 商品信息

    private Integer state; // 订单状态

    private Date inputTime; // 订单生成时间

    private String mark; // 备注

    private Address address; // 用户地址信息

    private Integer price; // 商品价格

    private Integer count; // 商品数量

    private Integer receipt = INNEED_RECEIPT; // 发票

    private Integer method;  // 取货方式

    private String itemparams; // 商品参数信息

    private String ordernum; // 订单号

    private ItemUser shopcar;


    public String getStateDispaly(){

        if(state == null){
            return "";
        }
        if(state == STATE_WAITING){
            return "待发货";
        } else if(state == STATE_SENDING){
            return "已发货";
        }else if(state == STATE_ARRIVE){
            return "已签收";
        }else if(state == STATE_REFUNDING){
            return "退款中";
        }else if(state == STATE_REFUNDED){
            return "已退款";
        } else {
            return "";
        }
    }



}